package com.qf.controller;

import com.qf.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.Date;

@Controller
@RequestMapping("/user3")
public class UserController3 {

    @RequestMapping("/respStr")
    @ResponseBody  //告诉springmvc这个方法的返回值是一个响应体内容，而不是一个视图
    public String respStr(){

        return "success~~~";
    }

//    @RequestMapping(value = "/respStr2",produces = "text/html;charset=utf-8")
    @RequestMapping(value = "/respStr2")
    @ResponseBody  //告诉springmvc这个方法的返回值是一个响应体内容，而不是一个视图
    public String respStr2(){

        return "成功了22~~~";
    }

    @RequestMapping(value = "/respStr3")
    @ResponseBody  //告诉springmvc这个方法的返回值是一个响应体内容，而不是一个视图
    public String respStr3(){

        return "成功了33~~~";
    }

    @RequestMapping("/respStr4")
    @ResponseBody
    public User resp4(){
        User user = new User();
        user.setName("中文");
        user.setPwd("1234456");
        user.setBirthday(new Date());

        return user;
    }
}
